package nl.saxion.security.gui;

import java.awt.Dimension;
import java.awt.FlowLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;

import nl.saxion.security.config.Config;

import com.google.inject.Inject;
import com.google.inject.name.Named;

public class MainFrame extends JFrame {

	private static final long serialVersionUID = 6432968267962270497L;
	
	private int width, height;
	
	private JPanel mainPanel;
	
	@Inject
	public MainFrame(JPanel mainPanel,@Named("DefaultConfig") Config config)
	{
		width = config.getAsInt(Config.KEY_GUI_WIDTH, 500);
		height = config.getAsInt(Config.KEY_GUI_HEIGHT, 600);
		
		setLayout(new FlowLayout());
		add(mainPanel);
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setSize(new Dimension(width, height));
		
		this.mainPanel = mainPanel;
	}
	
	// TODO: Deze hack weghalen
	public GUI getGUI()
	{
		return (GUI) mainPanel;
	}
	
}
